package cn.test;

import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class Main extends JFrame {
    private static final long serialVersionUID = 1L;

    public static void main(String[] args) {
        Main main = new Main();
        main.setTitle("pdf_money_计算");
        main.setSize(600, 400);
        main.setResizable(true);
        main.setLocationRelativeTo(null);
        main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        main.setVisible(true);
    }

    public Main() {
        initUI();
    }

    public void initUI() {
        JPanel panel = new JPanel();
        panel.setLayout(new FlowLayout(FlowLayout.CENTER, 10, 20));
        JButton button = new JButton("点击计算");
        panel.add(button);
        final JTextArea jtf = new JTextArea();

        panel.add(jtf);
        getContentPane().add(panel);
        button.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent event) {
                String doCacu;
                try {
                    doCacu = new TestA().doCacu();
                    jtf.setText(doCacu);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });

    }
}
